package com.ruoyi.web.controller.biz;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.Result;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.dto.YoukeCenterInfoDTO;
import com.ruoyi.system.domain.vo.BsCommentVO;
import com.ruoyi.system.domain.vo.BsRelationVO;
import com.ruoyi.system.service.IBsCommentService;
import com.ruoyi.system.service.IBsRelationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 游客端-个人中心
 *
 * @author ruoyi
 * @date 2023-11-25
 */
@Validated
@RequiredArgsConstructor
@Api(tags = "游客端-我的")
@RestController
@RequestMapping("/customer/personalCenter")
@Slf4j
public class BsYoukeCenterController extends BaseController {

    private final IBsRelationService iBsRelationService;
    private final IBsCommentService iBsCommentService;


    /**
     * 我的-统计信息
     */
    @ApiOperation(value = "我的-统计信息", tags = {"游客端-我的"})
    @GetMapping("/count")
    public Result<YoukeCenterInfoDTO> count() {
        YoukeCenterInfoDTO youkeCenterInfoDTO = iBsRelationService.youkeCenterCount();
        return Result.success(youkeCenterInfoDTO);
    }

    /**
     * 查询关系记录（关注、收藏、点赞）列表
     */
    @ApiOperation(value = "我的-关注/粉丝列表", tags = {"游客端-我的"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "scene", value = "列表场景id:     " +
                    "     * 1.关注列表\n" +
                    "     * 2.粉丝列表\n"),
            @ApiImplicitParam(name = "pageNum", value = "分页参数：第几页"),
            @ApiImplicitParam(name = "pageSize", value = "分页参数：每页条数"),
    })
    @GetMapping("/list")
    public Result<TableDataInfo<BsRelationVO>> list(@RequestParam() String scene) {
        startPage();
        List<BsRelationVO> list = iBsRelationService.queryPageListByScene(scene);
        return Result.success(getDataTable(list));
    }

    /**
     * 评论列表
     */
    @ApiOperation(value = "我的-评论列表", tags = {"游客端-我的"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "分页参数：第几页"),
            @ApiImplicitParam(name = "pageSize", value = "分页参数：每页条数"),
    })
    @GetMapping("/commentList")
    public Result<TableDataInfo<BsCommentVO>> personalCenterCommentList() {
        startPage();
        List<BsCommentVO> list = iBsCommentService.personalCenterCommentList();
        return Result.success(getDataTable(list));
    }
}
